cc.Class({
    extends: cc.Component,
 
    properties: {
        m_LoadPrefab:cc.Prefab,
        m_Background:cc.Node,
        m_Button_logo:cc.Node,
        m_Button_level:cc.Node,
        m_Button_endless:cc.Node,
        Panel_LevelMgr:{
            default:null,
            type:cc.Node,
        },
        NoUnlockedView:{
            default:null,
            type:cc.Label,
        }
    },
 
 
    onLoad () {

        let e = this;
        this.m_loadView=cc.instantiate(this.m_LoadPrefab);
        this.m_Background.addChild(this.m_loadView);
        this.m_loadView.y=-380;
        this.m_loadView=this.m_loadView.getComponent('loading');
        this.m_loadView.setProgress(1);
        this.m_loadView.finishCallBack=function () {
            this.m_Button_logo.active=true;
            this.m_Button_level.active=true;
            this.m_Button_endless.active=true;
            this.m_loadView.node.active=false;
            console.log("进度条执行完毕");
            
        }.bind(this);
        
       let userdata = DataMangrt.getData();
       if(userdata){
            console.log('UserData 关卡进度 = >',userdata);
       }else{
            console.log('No UserData = >',userdata);
       }
    },
 
    Onclicksatrt() {//开始游戏按钮
        DataMangrt.level = DataMangrt.getData();
        cc.director.loadScene('game');
        DataMangrt.initData();
        console.log('进入关卡',DataMangrt.level);
    },  
    Onclicklevel() {//选择关卡按钮
        let e = this;
        console.log('点击关卡事件');
        e.Panel_LevelMgr.active = true;
    }, 
    Onclickendless(){//无尽模式按钮
        let e = this;
        DataMangrt.level = 0;
        DataMangrt.initData();
        cc.director.loadScene('game');
        console.log('开始无尽模式');
    }
    // update (dt) {},
});
 
